function Q = Qvalue(F,theta)
    Q = 0;
    
    for i = 1:numel(F)
        index = F(i);
        Q = Q + theta(index);
    end
end